package day_2022_7_to_8.day48;

import java.util.ArrayList;
import java.util.List;

/**
 * @author haomin
 * @date 2022/08/23 20:32
 **/
public class Day38_2_Num89_GrayCode {
    class Solution {
        public List<Integer> grayCode(int n) {
            List<Integer> ans = new ArrayList<>();
            for(int i = 0; i < (1 << n); ++i){
                ans.add(i ^ (i>>1));
            }
            return ans;
        }
    }
}